<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>zzz的论坛</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" href="css/bootstrap-theme.min.css"/>
    <link rel="stylesheet" href="css/Community.css"/>
    <script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js" type="application/javascript"></script>
    <script>
        L2Dwidget.init({
            "model": {
                jsonPath: "https://unpkg.com/live2d-widget-model-hijiki@1.0.5/assets/hijiki.model.json",
                "scale": 1
            },
            "display": {
                "position": "right",
                "width": 100,
                "height": 200,
                "hOffset": 0,
                "vOffset": -20
            },
            "mobile": {
                "show": true,
                "scale": 0.5
            },
            "react": {
                "opacityDefault": 1,
                "opacityOnHover": 0.2
            }
        });
    </script>
    <script type="text/javascript">
        var a_idx = 0;
        jQuery(document).ready(function ($) {
            $("body").click(function (e) {
                var a = new Array("佐田", "闪电五连鞭", "🐎老师，发生甚么事了", "给我发了几张截图"
                    , "耗子尾汁", "不要搞，窝里斗", "小聪明", "二百斤的嘤国大理石也折不动我的手指头",
                    "左刺拳", "左正蹬", "右鞭腿", "化劲", "接化发", "婷婷");
                var $i = $("<span/>").text(a[a_idx]);
                a_idx = parseInt(Math.random() * (13 - 0 + 1), 10);
                var x = e.pageX,
                    y = e.pageY;
                $i.css({
                    "z-index": 9999,
                    "top": y - 20,
                    "left": x,
                    "position": "absolute",
                    "font-weight": "bold",
                    "color": "#5bc0de"
                });
                $("body").append($i);
                $i.animate({
                        "top": y - 180,
                        "opacity": 0
                    },
                    1500,
                    function () {
                        $i.remove();
                    });
            });
        });
    </script>

</head>
<script type="application/javascript">
    window.onload = function () {
        var closable = window.localStorage.getItem("closable");
        if (closable == "true") {
            window.close();
            window.localStorage.removeItem("closable");
        }

    }
</script>
<body>
<!-- 导航栏布局设计 -->
<div th:insert="~{navigation :: nav}"></div>
<!-- 首页问题列表问题设计 -->
<div class="container-fluid main">

    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <h2>
                <span class="glyphicon glyphicon-list" aria-hidden="true"></span>
                <span>发现</span>
            </h2>
            <hr/>
            <div class="media" th:each="question :${pagination.data}">
                <div class="media-left">
                    <a th:href="@{'/question/'+${question.id}}">
                        <img class="media-object img-rounded HeadFrame" th:src="${question.user.avatarUrl}"
                             th:alt="图片获取失败" onerror="this.src='/img/test.png'">
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading">
                        <a th:href="@{'/question/'+${question.id}}" th:text="${question.title}"></a>
                    </h4>
                    <span th:text="${question.description}"></span><br>
                    <span class="text-desc">
                        <!--回复数-->
                        ✍<span th:text="${question.commentCount}"></span>个回复
                        <!--                        浏览数-->
                        👀<span th:text="${question.viewCount}"></span>次浏览
                        <!--                        显示发布时间-->
                        🕐发布时间 <span th:text="${#dates.format(question.gmtCreate,'yyyy-MM-dd HH:mm')}"></span>
                    </span>
                    <a class="community-menu indent" th:href="@{'/question/delete/'+${question.id}}"
                       th:if="${session.user != null && (session.user.id == question.creator || session.user.id == 450)} "
                       style="text-decoration:none">
                        <span class="glyphicon glyphicon-trash" aria-hidden="true">删除</span>
                    </a>
                </div>
            </div>
            <!-- 这部分是对分页功能的设计-->
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <!--设计返回首页按钮-->
                    <li th:if="${pagination.showFirstPage}">
                        <a th:href="@{/(page=1,search=${search})}" aria-label="FirstPage">
                            <span aria-hidden="true">&lt;&lt;</span>
                        </a>
                    </li>
                    <!--                    设计向前一页按钮-->
                    <li th:if="${pagination.showPrevious}">
                        <a th:href="@{/(page=${pagination.currentPage -1},search=${search})}" aria-label="Previous">
                            <span aria-hidden="true">&lt;</span>
                        </a>
                    </li>
                    <!--设计分页展示内容，并将选中的分页高亮显示-->
                    <li th:each="page :${pagination.pages}" th:class="${pagination.currentPage == page}? 'active':''">
                        <a th:href="@{/(page=${page},search=${search})}" th:text="${page}">
                        </a>
                    </li>
                    <!--                显示向后一页按钮-->
                    <li th:if="${pagination.showNext}">
                        <a th:href="@{/(page=${pagination.currentPage +1},search=${search})}" aria-label="NextPage">
                            <span aria-hidden="true">&gt;</span>
                        </a>
                    </li>
                    <!--                    显示转到最后一页功能-->
                    <li th:if="${pagination.showEndPage}">
                        <a th:href="@{/(page=${pagination.totalPage},search=${search})}" aria-label="EndPage">
                            <span aria-hidden="true">&gt;&gt;</span>
                        </a>
                    </li>
                    <!--                    最后，分页栏还对不正常的分页数如-1，或页面数远远大于已有的页码数，进行了纠错处理。-->
                </ul>
            </nav>
        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <h3>热门话题</h3>
        </div>
    </div>
</div>
</body>
</html>